package com.rc.saas.tenant.vo.market;

import com.rc.saas.tenant.model.market.MarketActivity;
import com.rc.saas.tenant.model.market.MarketActivityTicket;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author frog
 * @date 2021/9/16
 */
public class MarketActivityVo extends MarketActivity {

    private String sendType;

    private String rewardType;

    private String status;

    private String ticketName;

    private String discountType;
    //优惠金额
    private BigDecimal discountAmount;
    //折扣率 0-1
    private BigDecimal discount;

    private int totalTicket;

    private int remainTicket;

    private int alreadyTicket;

    private BigDecimal useRequireAmount;

    private String reward;

    private List<MarketActivityTicket> list;

    private Integer sendTicketCount;

    private Integer sendMemberCount;

    private String prize;

    public String getReward() {
        if ("0".equals(discount)) {
            return "满" + useRequireAmount;
        } else if ("1".equals(sendType)) {
            return "邀请者";
        }

        return reward;
    }

    @Override
    public String getSendType() {
        if ("0".equals(sendType)) {
            return "新用户";
        } else if ("1".equals(sendType)) {
            return "邀请者";
        }
        return "";
    }


    @Override
    public String getRewardType() {
        if ("0".equals(rewardType)) {
            return "赠送优惠券";
        } else if ("1".equals(rewardType)) {
            return "消费返利";
        }
        return null;
    }

    @Override
    public String getStatus() {
        if ("0".equals(status)) {
            return "关闭";
        } else if ("1".equals(status)) {
            return "进行中";
        } else if ("2".equals(status)) {
            return "未开始";
        }
        return null;
    }

    public Integer getSendTicketCount() {
        return sendMemberCount * this.getSendCount();
    }


    public String getPrize() {

        if ("0".equals(discountType)) {
            return "满" + useRequireAmount + "立减" + discountAmount + "元";
        } else if ("1".equals(discountType)) {
            return "满" + useRequireAmount + "享"+ discount.multiply(new BigDecimal(10)).stripTrailingZeros() + "折";
        }

        return "";
    }

    @Override
    public void setSendType(String sendType) {
        this.sendType = sendType;
    }

    @Override
    public void setRewardType(String rewardType) {
        this.rewardType = rewardType;
    }

    @Override
    public void setStatus(String status) {
        this.status = status;
    }

    public String getTicketName() {
        return ticketName;
    }

    public void setTicketName(String ticketName) {
        this.ticketName = ticketName;
    }

    public String getDiscountType() {
        return discountType;
    }

    public void setDiscountType(String discountType) {
        this.discountType = discountType;
    }

    public BigDecimal getDiscountAmount() {
        return discountAmount;
    }

    public void setDiscountAmount(BigDecimal discountAmount) {
        this.discountAmount = discountAmount;
    }

    public BigDecimal getDiscount() {
        return discount;
    }

    public void setDiscount(BigDecimal discount) {
        this.discount = discount;
    }

    public int getTotalTicket() {
        return totalTicket;
    }

    public void setTotalTicket(int totalTicket) {
        this.totalTicket = totalTicket;
    }

    public int getRemainTicket() {
        return remainTicket;
    }

    public void setRemainTicket(int remainTicket) {
        this.remainTicket = remainTicket;
    }

    public int getAlreadyTicket() {
        return alreadyTicket;
    }

    public void setAlreadyTicket(int alreadyTicket) {
        this.alreadyTicket = alreadyTicket;
    }

    public BigDecimal getUseRequireAmount() {
        return useRequireAmount;
    }

    public void setUseRequireAmount(BigDecimal useRequireAmount) {
        this.useRequireAmount = useRequireAmount;
    }

    public void setReward(String reward) {
        this.reward = reward;
    }

    public List<MarketActivityTicket> getList() {
        return list;
    }

    public void setList(List<MarketActivityTicket> list) {
        this.list = list;
    }

    public void setSendTicketCount(Integer sendTicketCount) {
        this.sendTicketCount = sendTicketCount;
    }

    public Integer getSendMemberCount() {
        return sendMemberCount;
    }

    public void setSendMemberCount(Integer sendMemberCount) {
        this.sendMemberCount = sendMemberCount;
    }

    public void setPrize(String prize) {
        this.prize = prize;
    }
}
